﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using coffeeshop.coffeeDataSetTableAdapters;

namespace coffeeshop.Models
{
    public class SaleProduct
    {
        private static SaleProductTableAdapter objSaleProductAdapter = new SaleProductTableAdapter();
        public int ProductId { get; set; }
        public int WorkTimeId { get; set; }
        public double Quantity { get; set; }
        public Global.OrderType OrderType { get; set; }
        public int Price { get; set; }
        public int TableId { get; set; }
        public int CompoundProductId { get; set; }
        
        public bool insertSaleProduct()
        {
            try
            {
                int intResult = objSaleProductAdapter.InsertSaleProduct(ProductId, WorkTimeId, Quantity, (byte)OrderType, Price, TableId, CompoundProductId);
                return intResult == 1;
            }
            catch
            {
                return false;                
            }
        }       
    }
}
